<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:p="http://primefaces.org/ui"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core">

<ui:composition template="#{diretorios.template}/layout.xhtml">
	<ui:define name="content">
		<div>
			<h:outputText value="Cadastro"
				style="font-size: 18px; color: #eeeeee" />
			<br />
		</div>
		<div>
				<p:panel header="Cadastro de Usuário"
					style="margin-bottom: 5px; border: hidden; width: 780px;" />
		</div>
		<h:form>
			<p:panel id="panel"
				style="margin-bottom: 5px; border: hidden; width: 600px;">

				<p:messages showDetail="false" />

				<h:panelGrid columns="3">

					<h:outputText value="Nome:" />
					<p:inputText id="name"
						value="#{cadastroUsuario.usuario.idUsuario.nome}"
						style="width: 300px;" label="Nome" required="true" size="45" />				
					
					<h:panelGrid columns="2">
						<h:outputText value="Estado:" />				
						<h:selectOneListbox id="UF" size="1" style="min-width: 230px">
							<f:selectItem itemLabel="Selecione" />
							<f:selectItems value="#{pegarUFs.nomesUFs}" var="uf"
										   itemLabel="#{uf.nome}"
										   itemValue="#{uf.idUF}"/>									   
						</h:selectOneListbox>
					</h:panelGrid>

					<h:outputText />
					<h:outputText />
					<h:panelGrid columns="2">
						<h:outputText value="Cidade:"/>
						<h:selectOneListbox id="Cidade" size="1" style="min-width: 230px">
							<f:selectItem itemLabel="Selecione" />
							<f:selectItems value="#{pegarUFs.nomesCidades}"/>
						</h:selectOneListbox>
					</h:panelGrid>
					<h:outputText value="E-mail:" />
					<p:inputText id="email"
						value="#{cadastroUsuario.usuario.idUsuario.email}"
						style="width: 300px;" label="Email" required="true"></p:inputText>
					<p:commandButton id="botao" value="Testar disponibilidade"
						actionListener="#{cadastroUsuario.testaEmailAction}"
						title="Testar Disponibilidade" update="panel">
					</p:commandButton>

					<h:outputText value="Senha:" />
					<p:password id="senha1" value="#{cadastroUsuario.senha1}"
						style="width: 240px;" inline="true"
						promptLabel="Por favor digite a senha" weakLabel="Fraca!"
						goodLabel="Boa!" strongLabel="Forte!" />
					<h:outputLabel></h:outputLabel>

					<h:outputText value="Confirmar senha:" />
					<p:password id="senha2" value="#{cadastroUsuario.senha2}"
						style="width: 240px;" inline="true"
						promptLabel="Por favor digite a senha" weakLabel="Fraca!"
						goodLabel="Boa!" strongLabel="Forte!" />
					<h:outputLabel></h:outputLabel>
				</h:panelGrid>
				<div align="center">
					<p:commandButton value="Cadastrar"
						action="#{cadastroUsuario.cadastrar}" ajax="false"></p:commandButton>
				</div>
			</p:panel>
		</h:form>
	</ui:define>
</ui:composition>
</html>